﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Think.Lenovo.Com.Common;
using Think.Lenovo.Com.Models;
using Think.Lenovo.Com.Models.Users;
using Think.Lenovo.Com.DataAccess;
using Think.Lenovo.Com.Controllers.Filter;
namespace Think.Lenovo.Com.qiantai
{
    public partial class dataup : System.Web.UI.Page
    {
        public LinkedList<DataReportModel> list = new LinkedList<DataReportModel>();
        public ViewUserModel User = null;
        protected void Page_Load(object sender, EventArgs e)
        {

            #region //step 1 判断是否登录
            User = (ViewUserModel)Session["User"];
            if (User == null)
            {
                Response.Redirect("/home/Login.aspx");
            }
            #endregion

            #region step 2//得到一堆Excel模板
            try
            {
                DataReport dr = new DataReport();
                String p = String.Empty;
                int pageSize = 2;
                int pageIndex = 1;
                p = Request["pageIndex"];
                if (!Int32.TryParse(p, out pageIndex))
                {
                    pageIndex = 1;
                }

                #region //step 1. 得到列表

                list = dr.GetDataReports(pageIndex, pageSize, "");

                #endregion
                #region //step 2.得到分页页码
                String sql = "Select Count(Id) From tbl_datareporttemplate";
                int dataCount = dr.GetDataReportCount(sql, null);
                LinkedList<PageNumberModel>  pages = PageBuilder.LinkedPage(dataCount, 10, pageIndex, pageSize, "/qiantai/dataup.aspx?pageIndex={pageIndex}", "{pageIndex}");
                
                #endregion
            }
            catch
            {

            }
            #endregion
        }
    }
}